package cn.wx;

import cn.wx.properties.Agent;
import me.chanjar.weixin.cp.config.WxCpConfigStorage;
import me.chanjar.weixin.cp.config.impl.WxCpDefaultConfigImpl;

/**
 * 默认 WxCpConfigStorageFactory 实现
 *
 * @author: sunshaoping
 * @date: Create by in 5:30 下午 2020/5/26
 */
public class DefaultWxCpConfigStorageFactory implements WxCpConfigStorageFactory<Agent> {

    @Override
    public WxCpConfigStorage create(String corpId, Agent agent) {
        WxCpDefaultConfigImpl configStorage = new WxCpDefaultConfigImpl();
        configStorage.setCorpId(corpId);
        configStorage.setAgentId(agent.getAgentId());
        configStorage.setCorpSecret(agent.getSecret());
        configStorage.setToken(agent.getToken());
        configStorage.setAesKey(agent.getAesKey());

        return configStorage;
    }
}
